package ru.ognick.coachsystem.manager;

import ru.ognick.coachsystem.R;
import ru.ognick.coachsystem.common.Training;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class TrainingView {
	private Training training;
	
	private View view;
	
	public TrainingView(Context context, Training training) {
		this.training = training;

		LayoutInflater inflator = ((Activity) context).getLayoutInflater();
		view = inflator.inflate(R.layout.manager_training, null, true);
		view.setTag(this);
		view.setClickable(false);
		
		TextView name = (TextView) view.findViewById(R.id.name);
		String filename = training.getFilename().getName(); 
		name.setText(filename.replaceAll(".js", ""));
		
		TextView about =  (TextView) view.findViewById(R.id.about);
		about.setText(training.getAbout());
	}	
	
	public Training getTraining() {
		return training;
	}


	public View getView() {
		return view;
	}

}
